package com.byjc.aesb.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.byjc.aesb.entity.RcmsBaseinfo;
import com.byjc.aesb.mapper.RcmsBaseinfoMapper;
import com.byjc.aesb.service.RcmsBaseinfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 道口基本信息服务实现类
 * 
 * @author byjc
 */
@Slf4j
@Service
public class RcmsBaseinfoServiceImpl extends ServiceImpl<RcmsBaseinfoMapper, RcmsBaseinfo> implements RcmsBaseinfoService {

    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean batchSave(List<RcmsBaseinfo> baseinfoList) {
        if (baseinfoList == null || baseinfoList.isEmpty()) {
            log.warn("道口基本信息列表为空，跳过保存");
            return false;
        }

        try {
            boolean result = this.saveBatch(baseinfoList);
            log.info("批量保存道口基本信息成功，共保存{}条记录", baseinfoList.size());
            return result;
        } catch (Exception e) {
            log.error("批量保存道口基本信息失败", e);
            throw e;
        }
    }
} 